package com.heima.comment.controller.v1;

import com.heima.comment.service.CommentService;
import com.heima.model.comment.dtos.CommentDto;
import com.heima.model.comment.dtos.CommentLikeDto;
import com.heima.model.comment.dtos.CommentSaveDto;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author jay
 * @date 2022/11/16 14:18:09
 */
@RestController
@RequestMapping("/api/v1/comment")
public class CommentController {

    @Autowired
    private CommentService commentService;

    @PostMapping("/save")
    ResponseResult save(@RequestBody CommentSaveDto dto){
        return commentService.save(dto);
    }

    @PostMapping("/load")
    ResponseResult load(@RequestBody CommentDto dto){
        return commentService.load(dto);
    }

    @PostMapping("/like")
    ResponseResult like(@RequestBody CommentLikeDto dto){
        return commentService.like(dto);
    }
}
